using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using DblogStudio.BLL;

namespace DblogStudio.DAL.Models
{
    public partial class LichBaoTriCustom
    {
        public LichBaoTriCustom()
        {
        }

        public string MaLichBaoTri { get; set; }
        public int ChuKy { get; set; }
        public DateTime NgayBaoTri { get; set; }
        public DateTime HanBaoTri { get; set; }
        public string GhiChu { get; set; }
        public string MaChiTietMay { get; set; }
        public string MaNhiemVuBaoTri { get; set; }
        public string TenNguoiBaoTri
        {
            get;
            set;
        }
        public string _TenCongDoan
        {
            get;
            set;
        }
        public string _TenMaySanXuat
        {
            get;
            set;
        }
        public string _TenBoPhanMay
        {
            get;
            set;
        }
        public string _TenChiTietMay
        {
            get;
            set;
        }
        public string _TenNhiemVuBaoTri
        {
            get
            {
                var nv = BizNhiemVuBaoTri.GetByID(MaNhiemVuBaoTri);
                if (nv != null)
                    return nv.TenNhiemVuBaoTri;
                else
                    return "";
            }
        }
        public string _HanBaoTri
        {
            get
            {
                return string.Format("{0:dd/MM/yyyy}", HanBaoTri);
            }
        }
        public string _NgayBaoTri
        {
            get
            {
                return string.Format("{0:dd/MM/yyyy}", NgayBaoTri);
            }
        }
        public int _QuaHan
        {
            get
            {
                return DateTime.Now.Date.Subtract(NgayBaoTri.Date).Days;
            }
        }

        public int _QuaHan2
        {
            get
            {
                return NgayBaoTri.Date.Subtract(HanBaoTri.Date).Days;
            }
        }
    }
}
